package com.caeit.dao.bigscreen;

import com.caeit.model.bigscreen.BigscreenConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

/**
 * 业务应用表DAO
 *
 * @author : chenyr
 * @date : 2022-8-22
 */
public interface BigscreenConfigDao extends JpaRepository<BigscreenConfig, Long>, JpaSpecificationExecutor<BigscreenConfig> {

    @Query(value = "select * from bigscreen_config where delete_status = 0 and status = ?1 limit 1", nativeQuery = true)
    BigscreenConfig findEnableData(int status);
    @Modifying
    @Transactional
    @Query(value = "update bigscreen_config set status=0",nativeQuery = true)
    void updateAllStatusDisable();
}
